<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数据类型转换-其他转数字</title>
</head>
<body>
  <script>
    // 其他数据类型转String,使用Boolean()
    // string转Boolean
    console.log(Boolean(''));  //false
    console.log(Boolean('    ')); // true
    console.log(Boolean('hello')); // true

    // 这里是分割线
    console.log('=================');

    // 其他转Boolean
    console.log(Boolean(undefined)); // false
    console.log(Boolean(null)); // false
    console.log(Boolean(0)); // false
    console.log(Boolean(NaN)); // false
  </script>
</body>
</html>